from django.http.response import JsonResponse

# Create your views here.

from app import tasks


def test_add(req):
    x = req.GET.get('x', 0)
    y = req.GET.get('y', 0)
    x = int(x)
    y = int(y)
    result = tasks.add.delay(x, y)
    z = result.get()
    # 本地可以这样运行测试结果
    # z = tasks.add(x, y)
    return JsonResponse({
        'result': z
    })

